<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>layui表格</title>
    <link rel="stylesheet" href="/layui/css/layui.css">
</head>
<body>
<table id="demo" lay-filter="test"></table>
<script src="/layui/layui.js"></script>
<script th:inline="none">
    layui.use('table', function () {
        var table = layui.table;
        //第一个实例 换行[] 不然 thymeleaf 渲染会出错
        table.render({
            elem: '#demo'
            , url: '/userAllTable' //数据接口
            , page: true //开启分页
            ,cellMinWidth: 80
            , cols: [
                [ //表头
                {field: 'id', title: '编号', sort: true, fixed: 'left'}
                , {field: 'username', title: '用户名'}
                , {field: 'shengri', title: '生日'}
                ]
            ]
        });

    });
</script>
</body>
</html>